package flextestng.testing.utils
{
	/**
	 * Represents an invokable method on a class.
	 * 
	 * @author Dan Schultz
	 */
	public class ClassMethod
	{
		private var _className:String;
		private var _methodName:String;
		private var _parameters:Array;
		
		/**
		 * Constructor.
		 * 
		 * @param parameters Parameters that are passed to the method when invoked.
		 * @param className The class name that holds this method.
		 * @param methodName The method name this class represents.
		 */		
		public function ClassMethod(parameters:Array, className:String, methodName:String)
		{
			_className = className;
			_methodName = methodName;
		}
		
		/**
		 * Invokes the method on the specified instance.
		 * 
		 * TODO: Need to write docs for errors this method throws.
		 * 
		 * @param instance An instance of the class that contains this method.
		 * @throws 
		 */
		public function invoke(instance:Object):void
		{
			Function( instance[_methodName] ).apply(instance, _parameters);
		}
	}
}